package qldc.pm.tienan.portlet.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import qldc.pm.csdl.cd90.model.dto.CongDanDTO;
import qldc.pm.csdl.cd90.service.CongDanDTOLocalServiceUtil;
import qldc.pm.qtht.dmdc.enumclass.EnumGioiTinh;
import qldc.pm.qtht.dmdc.model.DanToc;
import qldc.pm.qtht.dmdc.service.DanTocLocalServiceUtil;
import qldc.pm.qtht.dmdc.utils.DateUtils;
import qldc.pm.qtht.dmdc.utils.DiaChiUtils;
import qldc.pm.tienan.dto.DS_NguoiTienAnDTO;
import qldc.pm.tienan.dto.DS_TaiPhamDTO;
import qldc.pm.tienan.dto.DS_XoaAnTichDTO;
import qldc.pm.tienan.dto.DoiTuongTrichLucDTO;
import qldc.pm.tienan.dto.HoGiaDinhDTO;
import qldc.pm.tienan.dto.KetQuaTrichLucDTO;
import qldc.pm.tienan.dto.LichSuXoaAnTichDTO;
import qldc.pm.tienan.dto.ThongKeTienAnDTO;
import qldc.pm.tienan.dto.YeuCauTrichLucDTO;
import qldc.pm.tienan.constants.TienAnConstants;
import qldc.pm.tienan.constants.TrangThaiTienAnTrongThongKeEnum;
import qldc.pm.tienan.model.PhieuThongTinVeNguoiCoTienAn;
import qldc.pm.tienan.model.TienAn;
import qldc.pm.tienan.model.YeuCauTrichLuc;
import qldc.pm.tienan.searchcontainer.DSHoGiaDinhDisplayTerms;
import qldc.pm.tienan.searchcontainer.DSTienAnDisplayTerms;
import qldc.pm.tienan.searchcontainer.YeuCauTrichLucDisplayTerms;
import qldc.pm.tienan.service.DoiTuongTienAnLocalServiceUtil;
import qldc.pm.tienan.service.KetQuaTrichLucLocalServiceUtil;
import qldc.pm.tienan.service.PhieuThongTinVeNguoiCoTienAnLocalServiceUtil;
import qldc.pm.tienan.service.TienAnLocalServiceUtil;
import qldc.pm.tienan.service.YeuCauTrichLucLocalServiceUtil;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.ServletResponseUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.util.PortalUtil;
import com.report.logic.Report;

public class ReportAction {
	SimpleDateFormat sdf = new SimpleDateFormat(TienAnConstants.DATE_PATTERN);
	private static Log _log = LogFactoryUtil.getLog(ReportAction.class);

	public void inDanhSachNguoiCoTienAnCanXoaAnTich(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {

		String redirect = ParamUtil.getString(request, "redirect");
		long tinhId = ParamUtil.getLong(request, DSTienAnDisplayTerms.TINH_ID );
		long quanHuyenId = ParamUtil.getLong(request, DSTienAnDisplayTerms.QUAN_HUYEN_ID );
		long phuongXaId = ParamUtil.getLong(request, DSTienAnDisplayTerms.PHUONG_XA_ID );


		String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, phuongXaId);

		Date tuNgayToaAn = ParamUtil.getDate(request, DSHoGiaDinhDisplayTerms.TU_NGAY_TOA_AN, sdf,null);
		Date denNgayToaAn = ParamUtil.getDate(request, DSHoGiaDinhDisplayTerms.DEN_NGAY_TOA_AN, sdf,null);

		String soDinhDanhCaNhans  = ParamUtil.getString(request, "soDinhDanhCaNhans");
		String tienAnIds = ParamUtil.getString(request, "tienAnIds");
		System.out.println("so dinh danh ca nha "+soDinhDanhCaNhans);
		System.out.println("tien an ids "+tienAnIds);

		String[] arrSoDinhDanhCaNhans = soDinhDanhCaNhans.split(",");
		String[] arrTienAnIds = tienAnIds.split(",");

		List<DS_NguoiTienAnDTO> reportList = DoiTuongTienAnLocalServiceUtil.createDataForReportDanhSachDoiTuongCanXoaAnTichExpandDiv(
				tinhId, quanHuyenId, phuongXaId, tuNgayToaAn, denNgayToaAn, arrSoDinhDanhCaNhans,arrTienAnIds);

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_tienan", reportList);
		data.put("vungDiaLy",vungDiaLy);
		data.put("TS_TuNgay",tuNgayToaAn);
		data.put("TS_DenNgay",denNgayToaAn);


		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.DS_CAN_XOA_AN_TICH;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.DOC_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.DOC_TYPE, in,Report.DOC_STREAM_TYPE);
		}

		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}



	}
	//In danh sach ho gia dinh
	public void inDanhSachHoGiaDinh(ActionRequest request,
			ActionResponse response) throws SystemException, IOException{

		String redirect = ParamUtil.getString(request, "redirect");
		String cmd = ParamUtil.getString(request, "cmd");
		if (cmd.equals(TienAnConstants.IN)){
			long tinhId = ParamUtil.getLong(request, DSHoGiaDinhDisplayTerms.TINH_ID );
			long quanHuyenId = ParamUtil.getLong(request, DSHoGiaDinhDisplayTerms.QUAN_HUYEN_ID );
			long phuongXaId = ParamUtil.getLong(request, DSHoGiaDinhDisplayTerms.PHUONG_XA_ID );


			String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, phuongXaId);

			Date tuNgayToaAn = ParamUtil.getDate(request, DSHoGiaDinhDisplayTerms.TU_NGAY_TOA_AN, sdf,null);
			Date denNgayToaAn = ParamUtil.getDate(request, DSHoGiaDinhDisplayTerms.DEN_NGAY_TOA_AN, sdf,null);

			String diaChi = DiaChiUtils.createBlockDiaChi(quanHuyenId, phuongXaId, "");
			List<HoGiaDinhDTO> reportList = DoiTuongTienAnLocalServiceUtil.findDsHoGiaDinhByVungDiaLy_ThoiGianToaAn(tinhId, quanHuyenId, phuongXaId, tuNgayToaAn, denNgayToaAn, -1, -1, null);

			HashMap<String, Object> data = new HashMap<String, Object>();
			data.put("list_hogiadinh", reportList);
			data.put("vungDiaLy",vungDiaLy);
			data.put("TS_TuNgay",tuNgayToaAn);
			data.put("TS_DenNgay",denNgayToaAn);


			PortletContext pc = request.getPortletSession().getPortletContext();
			String reportFileName = TienAnConstants.DS_HO_GIA_DINH;
			String reportFilePath = pc
					.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
							+ reportFileName + ".jrxml");

			File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
					reportFileName);
			if (Validator.isNotNull(file)) {
				InputStream in = new FileInputStream(file);

				HttpServletRequest httpServletRequest = PortalUtil
						.getHttpServletRequest(request);
				HttpServletResponse httpServletResponse = PortalUtil
						.getHttpServletResponse(response);
				ServletResponseUtil.sendFile(httpServletRequest,
						httpServletResponse,
						reportFileName + "." + Report.XLSX_TYPE, in,Report.XLS_STREAM_TYPE);
			}
		}
		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}

	}

	public void inReportDSNguoiCoTienAn(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {

		String redirect = ParamUtil.getString(request, "redirect");
		long tinhId = ParamUtil.getLong(request, DSTienAnDisplayTerms.TINH_ID );
		long quanHuyenId = ParamUtil.getLong(request, DSTienAnDisplayTerms.QUAN_HUYEN_ID );
		long phuongXaId = ParamUtil.getLong(request, DSTienAnDisplayTerms.PHUONG_XA_ID );
		int xoaAnTich = ParamUtil.getInteger(request, DSTienAnDisplayTerms.TRANG_THAI, TrangThaiTienAnTrongThongKeEnum.TAT_CA.getValue() );

		String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, phuongXaId);

		Date tuNgayToaAn = ParamUtil.getDate(request, DSHoGiaDinhDisplayTerms.TU_NGAY_TOA_AN, sdf,null);
		Date denNgayToaAn = ParamUtil.getDate(request, DSHoGiaDinhDisplayTerms.DEN_NGAY_TOA_AN, sdf,null);

		List<DS_NguoiTienAnDTO> reportList = DoiTuongTienAnLocalServiceUtil.findDsTienAnByVungDiaLy_ThoiGianToaAn(tinhId, quanHuyenId, phuongXaId, tuNgayToaAn, denNgayToaAn, xoaAnTich, -1, -1, null);


		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_tienan", reportList);
		data.put("vungDiaLy",vungDiaLy);
		data.put("TS_TuNgay",tuNgayToaAn);
		data.put("TS_DenNgay",denNgayToaAn);


		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.DS_TIEN_AN;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.XLSX_TYPE, in,Report.XLS_STREAM_TYPE);
		}

		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}
	}

	public void inReportDSXoaAnTich(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {
		String redirect = ParamUtil.getString(request, "redirect");
		long tinhId = ParamUtil.getLong(request, DSTienAnDisplayTerms.TINH_ID );
		long quanHuyenId = ParamUtil.getLong(request, DSTienAnDisplayTerms.QUAN_HUYEN_ID );
		long phuongXaId = ParamUtil.getLong(request, DSTienAnDisplayTerms.PHUONG_XA_ID );

		String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, phuongXaId);

		Date tuNgayXoaAnTich = ParamUtil.getDate(request, DSTienAnDisplayTerms.TU_NGAY_XOA_AN_TICH, sdf,null);
		Date denNgayXoaAnTich = ParamUtil.getDate(request,DSTienAnDisplayTerms.DEN_NGAY_XOA_AN_TICH, sdf,null);

		List<DS_XoaAnTichDTO> reportList = DoiTuongTienAnLocalServiceUtil
				.findByDS_XoaAnTich(
						tinhId, quanHuyenId, phuongXaId,tuNgayXoaAnTich, denNgayXoaAnTich, -1, -1, null);

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_xoaantich", reportList);
		data.put("vungDiaLy",vungDiaLy);
		data.put("TS_TuNgay",tuNgayXoaAnTich);
		data.put("TS_DenNgay",denNgayXoaAnTich);


		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.DS_XOA_AN_TICH;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.XLSX_TYPE, in,Report.XLS_STREAM_TYPE);
		}

		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}


	}
	public void inReportDSTrichLuc(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {
		String redirect = ParamUtil.getString(request, "redirect");
		long tinhId = ParamUtil.getLong(request, DSTienAnDisplayTerms.TINH_ID );
		long quanHuyenId = ParamUtil.getLong(request, DSTienAnDisplayTerms.QUAN_HUYEN_ID );
		long phuongXaId = ParamUtil.getLong(request, DSTienAnDisplayTerms.PHUONG_XA_ID );

		String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, phuongXaId);

		Date tuNgayTrichLuc = ParamUtil.getDate(request, "tuNgayTrichLuc", sdf,null);
		Date denNgayTrichLuc = ParamUtil.getDate(request, "denNgayTrichLuc", sdf,null);
		String coQuanYeuCauTrichLuc = ParamUtil.getString(request, "coQuanYeuCauTrichLuc",null);
		String nguoiThucHienTrichLuc = ParamUtil.getString(request, "nguoiThucHienTrichLuc",null);


		List<DoiTuongTrichLucDTO> reportList = KetQuaTrichLucLocalServiceUtil
				.findByDS_TrichLuc(
						tinhId, quanHuyenId, phuongXaId,tuNgayTrichLuc, denNgayTrichLuc,coQuanYeuCauTrichLuc,nguoiThucHienTrichLuc);

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_trichluc", reportList);
		data.put("vungDiaLy",vungDiaLy);
		data.put("TS_TuNgay",tuNgayTrichLuc);
		data.put("TS_DenNgay",denNgayTrichLuc);
		if (Validator.isNotNull(coQuanYeuCauTrichLuc) && !coQuanYeuCauTrichLuc.isEmpty()) {
			data.put("TS_CoQuanYeuCauTrichLuc",coQuanYeuCauTrichLuc);
		}
		if (Validator.isNotNull(nguoiThucHienTrichLuc) && !nguoiThucHienTrichLuc.isEmpty()) {
			data.put("TS_NguoiThucHienTrichLuc",nguoiThucHienTrichLuc);
		}



		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.DS_TRICH_LUC;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.XLSX_TYPE, in,Report.XLS_STREAM_TYPE);
		}

		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}


	}
	public void inReportDSHoSoTrichLuc(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {
		String redirect = ParamUtil.getString(request, "redirect");
		long tinhId = ParamUtil.getLong(request, YeuCauTrichLucDisplayTerms.TINH_ID );
		long quanHuyenId = ParamUtil.getLong(request, YeuCauTrichLucDisplayTerms.QUAN_HUYEN_ID );
		long phuongXaId = ParamUtil.getLong(request, YeuCauTrichLucDisplayTerms.PHUONG_XA_ID );

		String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, phuongXaId);

		Date tuNgayTrichLuc = ParamUtil.getDate(request, YeuCauTrichLucDisplayTerms.TU_NGAY_TAO_TRICH_LUC, sdf,null);
		Date denNgayTrichLuc = ParamUtil.getDate(request,YeuCauTrichLucDisplayTerms.DEN_NGAY_TAO_TRICH_LUC, sdf,null);
		String coQuanYeuCauTrichLuc = ParamUtil.getString(request, YeuCauTrichLucDisplayTerms.CO_QUAN_NGUOI_YEU_CAU_TRICH_LUC,null);
		String nguoiTaoTrichLuc = ParamUtil.getString(request, YeuCauTrichLucDisplayTerms.NGUOI_TAO_TRICH_LUC,null);


		List<YeuCauTrichLucDTO> reportList = YeuCauTrichLucLocalServiceUtil.findByCQ_NguoiThucHienTaoTrichLuc_ThoiGian_VungDiaLy(coQuanYeuCauTrichLuc, nguoiTaoTrichLuc, tinhId, quanHuyenId, phuongXaId, tuNgayTrichLuc, denNgayTrichLuc, -1, -1, null);

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_hosotrichluc", reportList);
		data.put("vungDiaLy",vungDiaLy);
		data.put("TS_TuNgay",tuNgayTrichLuc);
		data.put("TS_DenNgay",denNgayTrichLuc);
		if (Validator.isNotNull(coQuanYeuCauTrichLuc) && !coQuanYeuCauTrichLuc.isEmpty()) {
			data.put("TS_CoQuanYeuCauTrichLuc",coQuanYeuCauTrichLuc);
		}
		if (Validator.isNotNull(nguoiTaoTrichLuc) && !nguoiTaoTrichLuc.isEmpty()) {
			data.put("TS_NguoiThucHienTrichLuc",nguoiTaoTrichLuc);
		}



		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.DS_HO_SO_TRICH_LUC;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.XLSX_TYPE, in,Report.XLS_STREAM_TYPE);
		}

		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}


	}

	public void inReportThongKe(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {
		String redirect = ParamUtil.getString(request, "redirect");
		long tinhId = ParamUtil.getLong(request, DSTienAnDisplayTerms.TINH_ID );
		long quanHuyenId = ParamUtil.getLong(request, DSTienAnDisplayTerms.QUAN_HUYEN_ID );

		String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, 0);

		Date tuNgayTrichLuc = ParamUtil.getDate(request, DSTienAnDisplayTerms.TU_NGAY_THONG_KE, sdf,null);
		Date denNgayTrichLuc = ParamUtil.getDate(request, DSTienAnDisplayTerms.DEN_NGAY_THONG_KE, sdf,null);


		List<ThongKeTienAnDTO> reportList = TienAnLocalServiceUtil.thongKeTienAnTongQuat(tinhId, quanHuyenId, tuNgayTrichLuc, denNgayTrichLuc);
		//reportList.add(a);

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_thongke", reportList);
		data.put("vungDiaLy",vungDiaLy);
		data.put("TS_TuNgay",tuNgayTrichLuc);
		data.put("TS_DenNgay",denNgayTrichLuc);



		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.THONG_KE_TONG_QUAT;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.XLSX_TYPE, in,Report.XLS_STREAM_TYPE);
		}

		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}


	}
	public void inReportThongKeYeuCauTrichLuc(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {
		String redirect = ParamUtil.getString(request, "redirect");
		long tinhId = ParamUtil.getLong(request, YeuCauTrichLucDisplayTerms.TINH_ID );
		long quanHuyenId = ParamUtil.getLong(request, YeuCauTrichLucDisplayTerms.QUAN_HUYEN_ID );

		String vungDiaLy = DiaChiUtils.createVungDiaLy(tinhId,quanHuyenId, 0);

		Date tuNgayTrichLuc = ParamUtil.getDate(request, YeuCauTrichLucDisplayTerms.TU_NGAY_TAO_TRICH_LUC, sdf,null);
		Date denNgayTrichLuc = ParamUtil.getDate(request, YeuCauTrichLucDisplayTerms.DEN_NGAY_TAO_TRICH_LUC, sdf,null);

		String coQuanYeuCauTrichLuc = ParamUtil.getString(request, YeuCauTrichLucDisplayTerms.CO_QUAN_NGUOI_YEU_CAU_TRICH_LUC);
		String nguoiTaoTrichLuc = ParamUtil.getString(request, YeuCauTrichLucDisplayTerms.HO_VA_TEN_NGUOI_YEU_CAU_TRICH_LUC);

		List<ThongKeTienAnDTO> reportList = YeuCauTrichLucLocalServiceUtil.thongKeYeuCauTrichLuc(tinhId, quanHuyenId, tuNgayTrichLuc, tuNgayTrichLuc, coQuanYeuCauTrichLuc, nguoiTaoTrichLuc);
		//reportList.add(a);

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_thongke", reportList);
		data.put("vungDiaLy",vungDiaLy);
		data.put("TS_TuNgay",tuNgayTrichLuc);
		data.put("TS_DenNgay",denNgayTrichLuc);



		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.THONG_KE_YEU_CAU_TRICH_LUC;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.XLSX_TYPE, in,Report.XLS_STREAM_TYPE);
		}

		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}


	}

	public void inReportDSTaiPham(ActionRequest request, ActionResponse response)
			throws ParseException, SystemException, IOException {
		String redirect = ParamUtil.getString(request, "redirect");

		Date tuNgayPhamToi = ParamUtil.getString(request, "tuNgayPhamToi")
				.equalsIgnoreCase("") ? null : sdf.parse(ParamUtil.getString(
				request, "tuNgayPhamToi"));

		Date denNgayPhamToi = ParamUtil.getString(request, "denNgayPhamToi")
				.equalsIgnoreCase("") ? null : sdf.parse(ParamUtil.getString(
				request, "denNgayPhamToi"));

		long tinhId = ParamUtil.getString(request, "tinhId").equalsIgnoreCase(
				"") ? 0L : Long.valueOf(ParamUtil.getString(request, "tinhId"));
		long quanHuyenId = ParamUtil.getString(request, "quanHuyenId")
				.equalsIgnoreCase("") ? 0L : Long.valueOf(ParamUtil.getString(
				request, "quanHuyenId"));
		long phuongXaId = ParamUtil.getString(request, "phuongXaId")
				.equalsIgnoreCase("") ? 0L : Long.valueOf(ParamUtil.getString(
				request, "phuongXaId"));
		String diaChi = ParamUtil.getString(request, "diaChi");
		int start = ParamUtil.getString(request, "start").equalsIgnoreCase("") ? 0
				: Integer.valueOf(ParamUtil.getString(request, "start"));
		int end = ParamUtil.getString(request, "end").equalsIgnoreCase("") ? 0
				: Integer.valueOf(ParamUtil.getString(request, "end"));
		List<DS_TaiPhamDTO> reportList = DoiTuongTienAnLocalServiceUtil
				.findByDS_TaiPham(tinhId, quanHuyenId, phuongXaId, diaChi,
						tuNgayPhamToi, denNgayPhamToi, start, end);
		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("list_taipham", reportList);

		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.DS_TAI_PHAM;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.XLSX_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse, reportFileName + "."
							+ Report.XLSX_TYPE, in, "application/vnd.ms-excel");
		}
		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}

	}

	public void inReportTrichLuc(ActionRequest request, ActionResponse response)
			throws ParseException, SystemException, IOException,
			PortalException {
		// TODO: implement report action for trich luc module
		long tienAnId = ParamUtil.getLong(request, "tienAnId");
		String redirect = ParamUtil.getString(request, "redirect");
		long yeuCauTrichLucId = ParamUtil.getLong(request, "yeuCauTrichLucId");
		String soDinhDanhCaNhan = ParamUtil.getString(request,
				"soDinhDanhCaNhan");

		String toiDanh = "";
		String hinhPhatChinh = "";
		String hinhPhatBoSung = "";
		String banAnSo = "";
		String ngayToaAn = "";
		String ngayYeuCauTrichLuc = "";
		String hoVaTen = "";
		String tinhTrang = "";
		String toaAn = "";
		CongDanDTO congDanDTO = CongDanDTOLocalServiceUtil
				.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);
		if (Validator.isNotNull(congDanDTO)) {
			hoVaTen = congDanDTO.getHoVaTen();
		}
		YeuCauTrichLuc yeuCau = YeuCauTrichLucLocalServiceUtil
				.getYeuCauTrichLuc(yeuCauTrichLucId);
		if (Validator.isNotNull(yeuCau)) {
			ngayYeuCauTrichLuc = Validator.isNotNull(yeuCau.getCreateDate()) ? new SimpleDateFormat(
					"dd/MM/yyyy").format(yeuCau.getCreateDate()) : "";

		}

		if (tienAnId > 0) {
			TienAn tienAnToBeEdited = TienAnLocalServiceUtil
					.findByTienAnId(tienAnId);

			if (Validator.isNotNull(tienAnToBeEdited)) {
				// diaChiToaAnXuPhat = tienAnToBeEdited.getDiaChiToaAnXuPhat();
				toaAn = tienAnToBeEdited.getToaAnXuPhat();
				toiDanh = tienAnToBeEdited.getToiDanh();
				hinhPhatChinh = tienAnToBeEdited.getHinhPhatChinh();
				banAnSo = tienAnToBeEdited.getBanAnSo().concat(",");
				hinhPhatBoSung = tienAnToBeEdited.getHinhPhatBoSung();
				ngayToaAn = Validator
						.isNotNull(tienAnToBeEdited.getNgayToaAn()) ? new SimpleDateFormat(
						"dd/MM/yyyy").format(tienAnToBeEdited.getNgayToaAn())
						.concat(",") : "";
				tinhTrang = tienAnToBeEdited.getXoaAnTich() ? "Đã xóa án tích"
						: "Đang thi hành án";
			}
		}
		String thongTinBanAn = banAnSo.concat(ngayToaAn).concat(toaAn);
		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("toiDanh", toiDanh);
		data.put("hinhPhatChinh", hinhPhatChinh);
		data.put("hinhPhatBoSung", hinhPhatBoSung);
		data.put("thongTinBanAn", thongTinBanAn);
		data.put("tinhTrang", tinhTrang);
		data.put("ngayYeuCauTrichLuc", ngayYeuCauTrichLuc);
		data.put("hoVaTen", hoVaTen);

		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.TRICH_LUC_TIEN_AN;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.PDF_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.PDF_TYPE, in,
					"application/pdf");
		}
		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}
	}

	public void inReportChiTietTienAn(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {
		String redirect = ParamUtil.getString(request, "redirect");

		String soDinhDanhCaNhan = ParamUtil.getString(request,
				"soDinhDanhCaNhan");
		long tienAnId = ParamUtil.getLong(request, "tienAnId");
		// long doiTuongTienAnId = ParamUtil.getLong(request,
		// "doiTuongTienAnId");
		String hoVaTen = "";
		Date ngaySinh = null;
		String danToc = "";
		String quocTich = "";
		String banAnSo = "";
		String tenGoiKhac = "";
		String noiSinh = "";
		String noiThuongTru = "";
		String noiTamTru = "";
		String giayCMND_HoChieu = "";
		Date ngayCapCMND_HoChieu = null;
		String noiCapCMND_HoChieu = "";
		String hoTenCha = "";
		String hoTenMe = "";
		String hoTenVoChong = "";
		String toiDanh = "";
		String hinhPhatChinh = "";
		String hinhPhatBoSung = "";
		String nghiaVuDanSu = "";
		String anPhi = "";
		String tienAn = "";
		String ghiChu = "";
		String soPhucTham = "";
		String ngayPhucTham = "";
		String toaAnPhucTham = "";
		Date ngayToaAn = null;
		String nguoiTrichLuc = "";
		String thamPhan = "";
		String tenToaAn = "";
		String soToaAn = "";
		String soCMND_HoChieu = "";
		String gioiTinh = "";
		CongDanDTO congDanDTO = CongDanDTOLocalServiceUtil
				.findBySoDinhDanhCaNhan(soDinhDanhCaNhan);

		if (Validator.isNotNull(congDanDTO)) {
			hoVaTen = congDanDTO.getHoVaTen();
			tenGoiKhac = congDanDTO.getTenGoiKhac();
			gioiTinh = EnumGioiTinh.getKey(congDanDTO.getGioiTinh());

			giayCMND_HoChieu = congDanDTO.getSoCMND();

			if (Validator.isNotNull(congDanDTO.getSoCMND())){
				giayCMND_HoChieu = "CMND";
				soCMND_HoChieu = congDanDTO.getSoCMND();
				noiCapCMND_HoChieu = congDanDTO.getNoiCapCMND();
				ngayCapCMND_HoChieu = DateUtils.getDate(congDanDTO.getNgayCapCMND(), TienAnConstants.DATE_PATTERN);

			} else {
				giayCMND_HoChieu = "Hộ chiếu" ;
				noiCapCMND_HoChieu = null;
				ngayCapCMND_HoChieu = null;
				soCMND_HoChieu = congDanDTO.getSoHoChieu();

			}
			hoTenVoChong = congDanDTO.getHoVaTenNguoiCoQuanHe();


			ngaySinh = DateUtils.getDate(congDanDTO.getNgaySinh(), TienAnConstants.DATE_PATTERN);

			long danTocId = congDanDTO.getDanTocId();
			if (danTocId > 0) {
				DanToc dmdcDanToc = DanTocLocalServiceUtil.findById(danTocId);

				if (Validator.isNotNull(dmdcDanToc)) {
					danToc = dmdcDanToc.getTenDanToc();
				}
			}
			long noiSinhQuanHuyenId = congDanDTO.getNoiSinhQuanHuyenId();
			long noiSinhPhuongXaId = congDanDTO.getNoiSinhPhuongXaId();
			String noiSinhDiaChi = congDanDTO.getNoiSinhDiaChi();

			noiSinh = DiaChiUtils.createBlockDiaChi(noiSinhQuanHuyenId,
					noiSinhPhuongXaId, noiSinhDiaChi);
			quocTich = congDanDTO.getQuocTich();
			hoTenCha = congDanDTO.getHoVaTenCha();
			hoTenMe = congDanDTO.getHoVaTenMe();
		}
		if (tienAnId > 0) {
			TienAn tienAnToBeEdited = TienAnLocalServiceUtil
					.findByTienAnId(tienAnId);

			if (Validator.isNotNull(tienAnToBeEdited)) {

				toiDanh = tienAnToBeEdited.getToiDanh();
				hinhPhatChinh = tienAnToBeEdited.getHinhPhatChinh();
				banAnSo = tienAnToBeEdited.getBanAnSo();
				hinhPhatBoSung = tienAnToBeEdited.getHinhPhatBoSung();
				nghiaVuDanSu = tienAnToBeEdited.getNghiaVuDanSu();
				ghiChu = tienAnToBeEdited.getChuThich();
				tenToaAn = tienAnToBeEdited.getToaAnXuPhat();
				ngayToaAn = tienAnToBeEdited.getNgayToaAn();
				tienAn = tienAnToBeEdited.getMoTaTienAn();

				anPhi = String.valueOf(tienAnToBeEdited.getAnPhi());
				PhieuThongTinVeNguoiCoTienAn phieuThongTinVeNguoiCoTienAn = PhieuThongTinVeNguoiCoTienAnLocalServiceUtil
						.findByTienAnId(tienAnId);
				if (Validator.isNotNull(phieuThongTinVeNguoiCoTienAn)) {

					hoTenCha = phieuThongTinVeNguoiCoTienAn.getHoTenCha();
					hoTenMe = phieuThongTinVeNguoiCoTienAn.getHoTenMe();
					hoTenVoChong = phieuThongTinVeNguoiCoTienAn.getHoTenVoHoacChong();
					if (Validator.isNotNull(phieuThongTinVeNguoiCoTienAn
							.getHoTenVoHoacChong())) {
					hoTenVoChong = phieuThongTinVeNguoiCoTienAn
							.getHoTenVoHoacChong();
					}

					noiThuongTru = DiaChiUtils.createBlockDiaChi(phieuThongTinVeNguoiCoTienAn.getNoiThuongTruTinhId(), phieuThongTinVeNguoiCoTienAn.getNoiThuongTruQuanHuyenId(), phieuThongTinVeNguoiCoTienAn.getNoiThuongTruPhuongXaId(), phieuThongTinVeNguoiCoTienAn.getNoiThuongTruDiaChi());
					nguoiTrichLuc = phieuThongTinVeNguoiCoTienAn.getNguoiTrichLuc();
					thamPhan = phieuThongTinVeNguoiCoTienAn.getThamPhan();

					noiTamTru = DiaChiUtils.createBlockDiaChi(phieuThongTinVeNguoiCoTienAn.getNoiTamTruTinhId(), phieuThongTinVeNguoiCoTienAn.getNoiTamTruQuanHuyenId(), phieuThongTinVeNguoiCoTienAn.getNoiTamTruPhuongXaId(), phieuThongTinVeNguoiCoTienAn.getNoiTamTruDiaChi());


				}
			}
		}

		if(gioiTinh.equals("nu")) {
			gioiTinh = "Nữ";
		} else {
			gioiTinh = "Nam";
		}

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("hoVaTen", hoVaTen);
		data.put("ngayLap", new Date());
		data.put("gioiTinh", gioiTinh);
		data.put("ngaySinh", ngaySinh);
		data.put("danToc", danToc);
		data.put("quocTich", quocTich);
		data.put("banAnSo", banAnSo);
		data.put("tenGoiKhac", tenGoiKhac);
		data.put("noiSinh", noiSinh);
		data.put("noiThuongTru", noiThuongTru);
		data.put("noiTamTru", noiTamTru);
		data.put("giayCMND_HoChieu", giayCMND_HoChieu);
		data.put("ngayCapCMND_HoChieu", ngayCapCMND_HoChieu);
		data.put("noiCapCMND_HoChieu", noiCapCMND_HoChieu);
		data.put("hoTenCha", hoTenCha);
		data.put("hoTenMe", hoTenMe);
		data.put("hoTenVoChong", hoTenVoChong);
		data.put("toiDanh", toiDanh);
		data.put("hinhPhatChinh", hinhPhatChinh);
		data.put("hinhPhatBoSung", hinhPhatBoSung);
		data.put("nghiaVuDanSu", nghiaVuDanSu);
		data.put("anPhi", anPhi);
		data.put("tienAn", tienAn);
		data.put("ghiChu", ghiChu);
		data.put("soPhucTham", soPhucTham);
		data.put("ngayPhucTham", ngayPhucTham);
		data.put("toaAnPhucTham", toaAnPhucTham);
		data.put("ngayBanAn", ngayToaAn);
		data.put("tenToaAn", tenToaAn);
		data.put("soToaAn", soToaAn);
		data.put("gender", "anhTriPede");
		data.put("ngayToaAn", ngayToaAn);
		data.put("thamPhan", thamPhan);
		data.put("nguoiTrichLuc", nguoiTrichLuc);
		data.put("soCMND_HoChieu", soCMND_HoChieu);
		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.TRICH_LUC_BAN_AN;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.DOC_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.DOC_TYPE, in,
					Report.DOC_STREAM_TYPE);
		}
		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}

	}

	public void inReportQuanLyYeuCauTrichLuc(ActionRequest request,
			ActionResponse response) throws ParseException, SystemException,
			IOException {
		String redirect = ParamUtil.getString(request, "redirect");
		long yeuCauTrichLucId = ParamUtil.getLong(request, "yeuCauTrichLucId");
		YeuCauTrichLuc yeuCau = YeuCauTrichLucLocalServiceUtil.findByYeuCauTrichLucId(yeuCauTrichLucId);
		String soDinhDanhCaNhan = "";
		String hoVaTen = "";
		Date ngaySinh = null;
		String danToc = "";
		String quocTich = "";
		String banAnSo = "";
		String tenGoiKhac = "";
		String soCoQuanLyLichTuPhap = "";
		String coQuanLyLichTuPhap = "";
		Date ngayLap = null;
		String noiSinh = "";
		String noiThuongTru = "";
		String noiTamTru = "";
		String giayCMND_HoChieu = "";
		Date ngayCapCMND_HoChieu = null;
		String noiCapCMND_HoChieu = "";
		String hoTenCha = "";
		String hoTenMe = "";
		String hoTenVoChong = "";
		int gioiTinh =0;
		String soCMND_HoChieu = "";
		String kinhGui = "";
		Date phanHoiTruocNgay = new Date();


		if (Validator.isNotNull(yeuCau)) {
			hoVaTen = yeuCau.getHoVaTenDoiTuongTrichLuc();
			tenGoiKhac = yeuCau.getHoVaTenGoiKhac();
			gioiTinh = yeuCau.getGioiTinh();
			kinhGui = yeuCau.getKinhGui();
			soCoQuanLyLichTuPhap = yeuCau.getMaYeuCauTrichLuc();
			coQuanLyLichTuPhap = yeuCau.getCoQuanYeuCauTrichLuc();
			phanHoiTruocNgay = yeuCau.getNgayDeNghiTraTrichLuc();
			ngayLap = new Date();
			if (Validator.isNotNull(yeuCau.getSoCMNDDoiTuongTrichLuc())){
				giayCMND_HoChieu = "CMND";
				noiCapCMND_HoChieu = yeuCau.getNoiCapCMNDDoiTuongTrichLuc();
				ngayCapCMND_HoChieu = yeuCau.getNgayCapCMNDDoiTuongTrichLuc();
				soCMND_HoChieu = yeuCau.getSoCMNDDoiTuongTrichLuc();
			} else {

				giayCMND_HoChieu = "Hộ chiếu";
				noiCapCMND_HoChieu = yeuCau.getNoiCapHoChieuDoiTuongTrichLuc();
				ngayCapCMND_HoChieu = yeuCau.getNgayCapHoChieuDoiTuongTrichLuc();
				soCMND_HoChieu = yeuCau.getSoHoChieuDoiTuongTrichLuc();
			}
			long noiThuongTruQuanHuyenId = yeuCau.getNoiThuongTruDoiTuongTrichLucQuanHuyenId();
			long noiThuongTruPhuongXaId = yeuCau.getNoiThuongTruDoiTuongTrichLucPhuongXaId();
			String noiThuongTruDiaChi = yeuCau.getNoiThuongTruDoiTuongTrichLucDiaChi();

			noiThuongTru = DiaChiUtils.createBlockDiaChi(
					noiThuongTruQuanHuyenId, noiThuongTruPhuongXaId,
					noiThuongTruDiaChi);

			ngaySinh = yeuCau.getNgaySinhDoiTuongTrichLuc();

			long danTocId = yeuCau.getDanTocId();
			if (danTocId > 0) {
				DanToc dmdcDanToc = DanTocLocalServiceUtil.findById(danTocId);

				if (Validator.isNotNull(dmdcDanToc)) {
					danToc = dmdcDanToc.getTenDanToc();
				}
			}

			noiSinh = yeuCau.getNoiSinh();;
			quocTich = yeuCau.getQuocTich();
			hoTenCha = yeuCau.getHoVaTenCha();
			hoTenMe = yeuCau.getHoVaTenMe();
			hoTenVoChong = yeuCau.getHoTenVoHoacChong();
		}

		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("hoVaTen", hoVaTen);
		data.put("ngaySinh", ngaySinh);
		data.put("danToc", danToc);
		data.put("quocTich", quocTich);
		data.put("banAnSo", banAnSo);
		data.put("tenGoiKhac", tenGoiKhac);
		data.put("noiSinh", noiSinh);
		data.put("noiThuongTru", noiThuongTru);
		data.put("noiTamTru", noiTamTru);
		data.put("giayCMND_HoChieu", giayCMND_HoChieu);
		data.put("ngayCapCMND_HoChieu", ngayCapCMND_HoChieu);
		data.put("soCMND_HoChieu", soCMND_HoChieu);
		data.put("kinhGui", kinhGui);

		data.put("noiCapCMND_HoChieu", noiCapCMND_HoChieu);
		data.put("hoTenCha", hoTenCha);
		data.put("hoTenMe", hoTenMe);
		data.put("hoTenVoChong", hoTenVoChong);
		data.put("gioiTinh", gioiTinh);
		data.put("soCoQuanLyLichTuPhap", soCoQuanLyLichTuPhap);
		data.put("coQuanLyLichTuPhap", coQuanLyLichTuPhap);
		data.put("phanHoiTruocNgay", phanHoiTruocNgay);
		data.put("ngayLap", ngayLap);

		PortletContext pc = request.getPortletSession().getPortletContext();
		String reportFileName = TienAnConstants.REPORT_QUAN_LY_YEU_CAU_TRICH_LUC;
		String reportFilePath = pc
				.getRealPath(TienAnConstants.REPORT_TEMPLATE_FOLDER + "/"
						+ reportFileName + ".jrxml");

		File file = Report.createReport(data, Report.DOC_TYPE, reportFilePath,
				reportFileName);
		if (Validator.isNotNull(file)) {
			InputStream in = new FileInputStream(file);

			HttpServletRequest httpServletRequest = PortalUtil
					.getHttpServletRequest(request);
			HttpServletResponse httpServletResponse = PortalUtil
					.getHttpServletResponse(response);
			ServletResponseUtil.sendFile(httpServletRequest,
					httpServletResponse,
					reportFileName + "." + Report.DOC_TYPE, in,
					Report.DOC_STREAM_TYPE);
		}
		try {
			response.sendRedirect(redirect);
		} catch (IOException e) {
			_log.error(e);
		}

	}
	public static HashMap<String, Object> createDataReportKetQuaTrichLuc(KetQuaTrichLucDTO dto)  {


		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("coQuanLyLichTuPhap",dto.getCoQuanNguoiDung());
		data.put("soCoQuanLyLichTuPhap",dto.getMaKetQuaTrichLuc());
		Date newDate = new Date();

		//get yeu cau trich luc
		data.put("tenCoQuan",dto.getCoQuanYeuCauTrichLuc());
		data.put("soTuPhap",dto.getMaPhieuTrichLuc());
		data.put("ngayGuiLLTP",dto.getNgayGuiYeuCau());


		data.put("kinhGui",dto.getKinhGui());
		data.put("tenOngBa",dto.getHoVaTenNguoiCanTrichLuc());
		data.put("tinhTrangAnTich",dto.getTinhTrangAnTich());
		data.put("thongTinBanAn",dto.getThongTinAnTich());
		data.put("toiDanh",dto.getToiDanh());
		data.put("hinhPhatChinh",dto.getHinhPhatChinh());
		data.put("hinhPhatBoSung",dto.getHinhPhatBoSung());
		data.put("tinhTrangThiHanhAn",dto.getTrinhTrangThiHanhAn());
		data.put("ngayLap",newDate);
		return data;

	}
	public static  HashMap<String, Object>  createReportQuanLyLichSuXoaAnTich(LichSuXoaAnTichDTO dto){


		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("coQuanThiHanhAn",dto.getCoQuanThiHanhAn());
		data.put("ngayBanAn",dto.getNgayYeuCauXoaAnTich());
		data.put("kinhGui",dto.getKinhGui());
		data.put("soThiHanhAn",dto.getSoQuyetDinhThiHanhAn());

		data.put("soMau",dto.getMaHoSoXoaAnTich());
		data.put("tenOngBa",dto.getHoVaTenDoiTuongTienAn());
		data.put("thongBaoViecChapHanh",dto.getHinhPhat());
		data.put("diaChi",dto.getDiaChi());
		data.put("banAnSo",dto.getBanAnSo());
		data.put("ngayBanAn",dto.getNgayToaAn());
		data.put("tenToaAn",dto.getToaAn());
		data.put("ngayThiHanhAn",dto.getNgayQuyetDinhThiHanhAn());
		data.put("ngayLap",new Date());
		return data;
	}
}
